package wellness.activities.beans;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;

public class DayBean {

	private Integer day;
	private Integer month;
	private Integer year;
	private boolean isInvalidDay;
	private boolean isToday;
	private boolean hasActivity;
	private boolean possuiAgendamento;

	public DayBean() {
	}

	public DayBean(Integer day, Integer month, Integer year,
			boolean isInvalidDay, boolean isToday) {
		this.day = day;
		this.month = month;
		this.year = year;
		this.isInvalidDay = isInvalidDay;
		this.isToday = isToday;
	}
	
	public GregorianCalendar getData(){
		return new GregorianCalendar(getYear(), getMonth(), getDay());
	}

	public Integer getDay() {
		return day;
	}

	public void setDay(Integer day) {
		this.day = day;
	}

	public boolean isToday() {
		return isToday;
	}

	public void setToday(boolean isToday) {
		this.isToday = isToday;
	}
	
	public boolean isHasActivity() {
		return hasActivity;
	}

	public void setHasActivity(boolean hasActivity) {
		this.hasActivity = hasActivity;
	}

	public boolean isInvalidDay() {
		return isInvalidDay;
	}

	public void setInvalidDay(boolean isInvalidDay) {
		this.isInvalidDay = isInvalidDay;
	}

	public Integer getMonth() {
		return month;
	}

	public Integer getYear() {
		return year;
	}

	public void setMonth(Integer month) {
		this.month = month;
	}

	public void setYear(Integer year) {
		this.year = year;
	}
	
	public boolean isPossuiAgendamento() {
		GregorianCalendar data = new GregorianCalendar(this.getYear(), this.getMonth(), this.getDay());
		SimpleDateFormat br = new SimpleDateFormat("dd/MM/yyyy");
		for(AgendamentoBean t: LoadBeans.getAgendamentos()){
			if(t.isPraticou() == null && br.format(t.getInicio().getTime()).equals(br.format(data.getTime()))){
				return true;
			}
		}
		return false;
	}

}
